package cn.mugutu.finance.service.system;

import cn.mugutu.finance.query.BaseQuery;
import cn.mugutu.finance.utils.Pager;
import org.springframework.stereotype.Service;

import java.io.Serializable;
import java.util.List;

@Service
public interface BaseService<T> {

    void save(T t);

    void saveOrUpdate(T t);

    void delete(Serializable id);

    void deleteAll();

    void update(T t);

    T get(Serializable id);

    List<T> getAll();

    List<?> findByHql(String hql, Object... params);

    Object getUniqueResult(String hql, Object... params);

    List<T> findAll();

    Pager<T> findByPage(BaseQuery baseQuery);

    /**
     * 分页查询
     *
     * @param hql
     * @param currentPage
     * @param pageSize
     * @return
     */
    Pager<T> findByPage(String hql, int currentPage, int pageSize, Object... params);

}
